package com.zhentao.controller;

import com.zhentao.model.vo.common.Result;
import com.zhentao.model.vo.common.ResultCodeEnum;
import com.zhentao.service.FileStorageService;
import com.zhentao.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.IOException;

@RestController
@RequestMapping("/admin/system")
public class FileUploadController {

    @Resource
    private SysUserService sysUserService ;

    @PostMapping(value = "/fileUpload")
    public Result<String> fileUploadService(MultipartFile file) throws IOException {
        String fileUrl=sysUserService.uploadImages(file);
        return Result.build(fileUrl , ResultCodeEnum.SUCCESS) ;
    }

}